// pages/cart/cart.ts
import CartList from "./Vo/cartListVo"
Page({

    /**
     * 页面的初始数据
     */
    data: {
        cartList: [], //购物车列表
    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad() {

    },

    /**
     * 生命周期函数--监听页面显示
     */
    onShow() {
        // 自定义tabbar
        if (typeof this.getTabBar === 'function' &&
            this.getTabBar()) {
            this.getTabBar().setData({
                selected: 2
            })
        }
        this.setData({
            cartList: getApp().globalData.cartList
        })
        console.log(this.data.cartList)
    },
    chooseGood(event: any) {
        let index = event.currentTarget.dataset.index;
        console.log(index)
        this.data.cartList[index].choose = !this.data.cartList[index].choose
    }
})